package com.woniuxy.personal.core.controller;


import com.woniuxy.common.CommonResult;
import com.woniuxy.personal.core.model.PlAftersale;
import com.woniuxy.personal.core.service.PlAftersaleService;
import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Date;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author gmx
 * @since 2021-07-01
 */
@RestController
@RequestMapping("/plAftersale")
public class PlAftersaleController {
    @Resource
    PlAftersaleService aftersaleService;
    /**
     * Description :申请售后服务
     * ChangeLog : 1. 创建 (2021/7/1 15:33 [fulang]);
     * @param aftersale
     * @return com.woniuxy.common.CommonResult
    */
    @ApiOperation(value = "申请售后服务")
    @PostMapping("insertAfterSale")
    public CommonResult insertAfterSale(@RequestBody PlAftersale aftersale){
        aftersale.setCreatetime(new Date());
        aftersale.setProgress(1);
        int i = aftersaleService.insert(aftersale);
        if (i>0){
            return CommonResult.success();
        }
        return CommonResult.fail("申请售后服务失败");
    }
}

